package com.ss.android.newmedia.a;

import android.view.View;

import com.ss.android.common.download.DownloadShortInfo;
import com.ss.android.common.util.ToolUtils;

final class o implements Runnable {
    private final BrowserFragment.e$a e;
    private final DownloadShortInfo a;
    private final int b;
    private final long c;
    private final long d;

    o(BrowserFragment.e$a arg1, DownloadShortInfo arg2, int arg3, long arg4, long arg6) {
        this.e = arg1;
        this.a = arg2;
        this.b = arg3;
        this.c = arg4;
        this.d = arg6;

    }

    public final void run() {
        int v4 = 8;
        if(this.a != null && this.a.id == this.e.a) {
            try {
                this.e.b.n = this.a;
                String v0_1 = this.e.b.getResources().getString(com.ss.android.article.browser.R.string.detail_download);
                this.e.b.mDownloadProgressBar.setVisibility(View.GONE);
                this.e.b.mDownloadStatusTv.setBackgroundResource(com.ss.android.article.browser.R.drawable.dl);
                this.e.b.mDownloadStatusTv.setTextColor(this.e.b.getResources().getColor(com.ss.android.article.browser.R.color.hp));
                if(this.b == 1) {
                    v0_1 = this.e.b.getResources().getString(com.ss.android.article.browser.R.string.detail_download_pause);
                    this.e.b.mDownloadProgressBar.setVisibility(View.VISIBLE);
                    this.e.b.mDownloadStatusTv.setBackgroundResource(0);
                }
                else if(this.b == 2) {
                    v0_1 = this.e.b.getResources().getString(com.ss.android.article.browser.R.string.detail_download_resume);
                    this.e.b.mDownloadProgressBar.setVisibility(View.VISIBLE);
                    this.e.b.mDownloadStatusTv.setBackgroundResource(0);
                }
                else if(this.b == 3) {
                    if(this.e.b.n.b == 16) {
                        v0_1 = this.e.b.getResources().getString(com.ss.android.article.browser.R.string.detail_download_restart);
                        this.e.b.mDownloadProgressBar.setVisibility(View.GONE);
                        this.e.b.mDownloadStatusTv.setBackgroundResource(com.ss.android.article.browser.R.drawable.dl);
                    }
                    else if(this.e.b.n.b == v4) {
                        if(ToolUtils.isAppInstalled(this.e.b.mContext, this.e.b.I)) {
                            v0_1 = this.e.b.getResources().getString(com.ss.android.article.browser.R.string.detail_download_open);
                            this.e.b.mDownloadProgressBar.setVisibility(View.GONE);
                            this.e.b.mDownloadStatusTv.setBackgroundResource(com.ss.android.article.browser.R.drawable.dl);
                        }
                        else {
                            v0_1 = this.e.b.getResources().getString(com.ss.android.article.browser.R.string.detail_download_install);
                            this.e.b.mDownloadProgressBar.setVisibility(View.GONE);
                            this.e.b.mDownloadStatusTv.setBackgroundResource(com.ss.android.article.browser.R.drawable.dn);
                            this.e.b.mDownloadStatusTv.setTextColor(this.e.b.getResources().getColor(com.ss.android.article.browser.R.color.hl));
                        }
                    }
                }

                if(this.c > 0) {
                    this.e.b.mDownloadProgressBar.setProgress(((int)(this.d * 100 / this.c)));
                }
                else {
                    this.e.b.mDownloadProgressBar.setProgress(0);
                }

                this.e.b.mDownloadStatusTv.setText(((CharSequence)v0_1));
            }
            catch(Exception v0) {
                v0.printStackTrace();
            }
        }
    }
}

